<template>
    <div ref="parent" class="gameMap">
        <canvas ref="canvas" tabindex="0">

        </canvas>
    </div>
</template>

<script>
import { gameMap } from '@/assets/scripts/gameMap';
import { ref, onMounted } from 'vue';
import { useStore } from 'vuex';

export default {
    name: "gameMap",
    setup() {
        let parent = ref(null);
        let canvas = ref(null);
        let store = useStore();
        onMounted(() => {
            store.commit("updateGameObject",new gameMap(canvas.value.getContext('2d'),parent.value,store))
        });
        return {
            parent,
            canvas,
        }
    }
}
</script>

<style>
.gameMap{
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
</style>